﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BIExtAuth.DAL;
using BIExtAuth.Model;
using System.Data;

namespace BIExtAuth.BLL
{
    /// <summary>
    /// ClassName：用户业务逻辑类
    /// Author：scc-john
    /// CreateDate：2013-09-22
    /// </summary>
    public class UserBLL
    {
        private UserDAL userDAL = null;
        public UserBLL()
        {
            this.userDAL = new UserDAL();
        }

        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="user">BI用户</param>
        /// <returns>受影响的行数</returns>
        public int AddUser(BIUser user)
        {
            return this.userDAL.AddUser(user);
        }

        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="user">BI用户</param>
        /// <returns>受影响的行数</returns>
        
        public int UpdateUser(BIUser user)
        {
            return this.userDAL.UpdateUser(user);
        }

        /// <summary>
        /// 更新用户密码
        /// </summary>
        /// <param name="user">BI用户</param>
        /// <returns>受影响的行数</returns>
        public int ChangePwd(BIUser user)
        {
            return this.userDAL.ChangePwd(user);
        }

        /// <summary>
        /// 检查用户信息
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="password">用户密码</param>
        /// <returns>检查用户是否存在</returns>
        public bool CheckUser(string userID, string password)
        {
            return this.userDAL.CheckUser(userID, password);
        }

        /// <summary>
        /// 获取所有的用户
        /// </summary>
        /// <returns>用户集合</returns>
        public DataSet GetAllUsers()
        {
            return this.userDAL.GetAllUsers();
        }

        /// <summary>
        /// 根据用户ID查询用户
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <returns>BI用户</returns>
        public BIUser GetUserByUserID(string userID)
        {
            return this.userDAL.GetUserByUserID(userID);
        }
    }
}
